#ifndef FILE_IO_HEADER
#define FILE_IO_HEADER

// this header needs
#include <stdio.h>
#include "../ARRAY.h"
#include "../CHAR/CHAR_ARR/STRING/STRING.h"
#include "../NUMBER/NUMBER.h"

// file paths will be treated as UTF8
#define FILE_PATH_ENC CHAR_ENC_UTF8 

// wrappers to some stdio.h functions
FILE * def_fopen(char * fpath, char * open_mode);
smax def_fgetc(FILE * fp);
void def_fseek(FILE * fp, smax offset, smax whence);
void def_fputc(smax ch, FILE * fp);
void def_fclose(FILE * fp);

// path string related functions
char * get_file_dir(char * fpath, char * out_file_dir);
char * get_file_ext(char * fpath);

// functions to do usual file operations
umax get_file_size(char * fpath);
void * get_fbytes(char * fpath, umax pos, umax size);
void * load_file_mem(char * fpath);

// functions to deal with file data loaded in memory
umax dump_mem_file(char * fpath, umax file_size, void * file_data);
extern void * insert_bytes(void * target, umax tsize, void * ins_pos, void * src, umax ssize);
extern umax remove_bytes(void * target, umax tsize, void * rm_pos, umax rm_size);

#include "FILE.c"

#endif // FILE_IO_HEADER
